(0) Obligation:

The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(1, n^1).


The TRS R consists of the following rules:

2nd(cons(X, n__cons(Y, Z))) → activate(Y)
from(X) → cons(X, n__from(n__s(X)))
cons(X1, X2) → n__cons(X1, X2)
from(X) → n__from(X)
s(X) → n__s(X)
activate(n__cons(X1, X2)) → cons(activate(X1), X2)
activate(n__from(X)) → from(activate(X))
activate(n__s(X)) → s(activate(X))
activate(X) → X

Rewrite Strategy: INNERMOST

(1) DependencyGraphProof (BOTH BOUNDS(ID, ID) transformation)

The following rules are not reachable from basic terms in the dependency graph and can be removed:
2nd(cons(X, n__cons(Y, Z))) → activate(Y)

(2) Obligation:

The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(1, n^1).


The TRS R consists of the following rules:

activate(n__from(X)) → from(activate(X))
from(X) → cons(X, n__from(n__s(X)))
from(X) → n__from(X)
s(X) → n__s(X)
activate(X) → X
activate(n__cons(X1, X2)) → cons(activate(X1), X2)
cons(X1, X2) → n__cons(X1, X2)
activate(n__s(X)) → s(activate(X))

Rewrite Strategy: INNERMOST

(3) TrsToWeightedTrsProof (BOTH BOUNDS(ID, ID) transformation)

Transformed TRS to weighted TRS

(4) Obligation:

The Runtime Complexity (innermost) of the given CpxWeightedTrs could be proven to be BOUNDS(1, n^1).


The TRS R consists of the following rules:

activate(n__from(X)) → from(activate(X)) [1]
from(X) → cons(X, n__from(n__s(X))) [1]
from(X) → n__from(X) [1]
s(X) → n__s(X) [1]
activate(X) → X [1]
activate(n__cons(X1, X2)) → cons(activate(X1), X2) [1]
cons(X1, X2) → n__cons(X1, X2) [1]
activate(n__s(X)) → s(activate(X)) [1]

Rewrite Strategy: INNERMOST

(5) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)

Infered types.

(6) Obligation:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

activate(n__from(X)) → from(activate(X)) [1]
from(X) → cons(X, n__from(n__s(X))) [1]
from(X) → n__from(X) [1]
s(X) → n__s(X) [1]
activate(X) → X [1]
activate(n__cons(X1, X2)) → cons(activate(X1), X2) [1]
cons(X1, X2) → n__cons(X1, X2) [1]
activate(n__s(X)) → s(activate(X)) [1]

The TRS has the following type information:
activate :: n__from:n__s:n__cons → n__from:n__s:n__cons
n__from :: n__from:n__s:n__cons → n__from:n__s:n__cons
from :: n__from:n__s:n__cons → n__from:n__s:n__cons
cons :: n__from:n__s:n__cons → n__from:n__s:n__cons → n__from:n__s:n__cons
n__s :: n__from:n__s:n__cons → n__from:n__s:n__cons
s :: n__from:n__s:n__cons → n__from:n__s:n__cons
n__cons :: n__from:n__s:n__cons → n__from:n__s:n__cons → n__from:n__s:n__cons

Rewrite Strategy: INNERMOST

(7) CompletionProof (UPPER BOUND(ID) transformation)

The TRS is a completely defined constructor system, as every type has a constant constructor and the following rules were added:
none

And the following fresh constants:

const

(8) Obligation:

Runtime Complexity Weighted TRS where all functions are completely defined. The underlying TRS is:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

activate(n__from(X)) → from(activate(X)) [1]
from(X) → cons(X, n__from(n__s(X))) [1]
from(X) → n__from(X) [1]
s(X) → n__s(X) [1]
activate(X) → X [1]
activate(n__cons(X1, X2)) → cons(activate(X1), X2) [1]
cons(X1, X2) → n__cons(X1, X2) [1]
activate(n__s(X)) → s(activate(X)) [1]

The TRS has the following type information:
activate :: n__from:n__s:n__cons → n__from:n__s:n__cons
n__from :: n__from:n__s:n__cons → n__from:n__s:n__cons
from :: n__from:n__s:n__cons → n__from:n__s:n__cons
cons :: n__from:n__s:n__cons → n__from:n__s:n__cons → n__from:n__s:n__cons
n__s :: n__from:n__s:n__cons → n__from:n__s:n__cons
s :: n__from:n__s:n__cons → n__from:n__s:n__cons
n__cons :: n__from:n__s:n__cons → n__from:n__s:n__cons → n__from:n__s:n__cons
const :: n__from:n__s:n__cons

Rewrite Strategy: INNERMOST

(9) CpxTypedWeightedTrsToRntsProof (UPPER BOUND(ID) transformation)

Transformed the TRS into an over-approximating RNTS by (improved) Size Abstraction.
The constant constructors are abstracted as follows:

const => 0

(10) Obligation:

Complexity RNTS consisting of the following rules:

activate(z) -{ 1 }→ X :|: X >= 0, z = X
activate(z) -{ 1 }→ s(activate(X)) :|: z = 1 + X, X >= 0
activate(z) -{ 1 }→ from(activate(X)) :|: z = 1 + X, X >= 0
activate(z) -{ 1 }→ cons(activate(X1), X2) :|: X1 >= 0, X2 >= 0, z = 1 + X1 + X2
cons(z, z') -{ 1 }→ 1 + X1 + X2 :|: X1 >= 0, X2 >= 0, z = X1, z' = X2
from(z) -{ 1 }→ cons(X, 1 + (1 + X)) :|: X >= 0, z = X
from(z) -{ 1 }→ 1 + X :|: X >= 0, z = X
s(z) -{ 1 }→ 1 + X :|: X >= 0, z = X

Only complete derivations are relevant for the runtime complexity.

(11) CompleteCoflocoProof (EQUIVALENT transformation)

Transformed the RNTS (where only complete derivations are relevant) into cost relations for CoFloCo:

eq(start(V, V1),0,[activate(V, Out)],[V >= 0]).
eq(start(V, V1),0,[from(V, Out)],[V >= 0]).
eq(start(V, V1),0,[s(V, Out)],[V >= 0]).
eq(start(V, V1),0,[cons(V, V1, Out)],[V >= 0,V1 >= 0]).
eq(activate(V, Out),1,[activate(X3, Ret0),from(Ret0, Ret)],[Out = Ret,V = 1 + X3,X3 >= 0]).
eq(from(V, Out),1,[cons(X4, 1 + (1 + X4), Ret1)],[Out = Ret1,X4 >= 0,V = X4]).
eq(from(V, Out),1,[],[Out = 1 + X5,X5 >= 0,V = X5]).
eq(s(V, Out),1,[],[Out = 1 + X6,X6 >= 0,V = X6]).
eq(activate(V, Out),1,[],[Out = X7,X7 >= 0,V = X7]).
eq(activate(V, Out),1,[activate(X11, Ret01),cons(Ret01, X21, Ret2)],[Out = Ret2,X11 >= 0,X21 >= 0,V = 1 + X11 + X21]).
eq(cons(V, V1, Out),1,[],[Out = 1 + X12 + X22,X12 >= 0,X22 >= 0,V = X12,V1 = X22]).
eq(activate(V, Out),1,[activate(X8, Ret02),s(Ret02, Ret3)],[Out = Ret3,V = 1 + X8,X8 >= 0]).
input_output_vars(activate(V,Out),[V],[Out]).
input_output_vars(from(V,Out),[V],[Out]).
input_output_vars(s(V,Out),[V],[Out]).
input_output_vars(cons(V,V1,Out),[V,V1],[Out]).

CoFloCo proof output:
Preprocessing Cost Relations
=====================================

#### Computed strongly connected components
0. non_recursive : [cons/3]
1. non_recursive : [from/2]
2. non_recursive : [s/2]
3. recursive [non_tail] : [activate/2]
4. non_recursive : [start/2]

#### Obtained direct recursion through partial evaluation
0. SCC is completely evaluated into other SCCs
1. SCC is partially evaluated into from/2
2. SCC is completely evaluated into other SCCs
3. SCC is partially evaluated into activate/2
4. SCC is partially evaluated into start/2

Control-Flow Refinement of Cost Relations
=====================================

### Specialization of cost equations from/2
* CE 9 is refined into CE [10]
* CE 8 is refined into CE [11]


### Cost equations --> "Loop" of from/2
* CEs [10] --> Loop 7
* CEs [11] --> Loop 8

### Ranking functions of CR from(V,Out)

#### Partial ranking functions of CR from(V,Out)


### Specialization of cost equations activate/2
* CE 7 is refined into CE [12]
* CE 5 is refined into CE [13,14]
* CE 6 is refined into CE [15]


### Cost equations --> "Loop" of activate/2
* CEs [15] --> Loop 9
* CEs [12,13] --> Loop 10
* CEs [14] --> Loop 11

### Ranking functions of CR activate(V,Out)
* RF of phase [10,11]: [V]

#### Partial ranking functions of CR activate(V,Out)
* Partial RF of phase [10,11]:
- RF of loop [10:1,11:1]:
V


### Specialization of cost equations start/2
* CE 2 is refined into CE [16,17]
* CE 3 is refined into CE [18,19]
* CE 4 is refined into CE [20]


### Cost equations --> "Loop" of start/2
* CEs [16,17,18,19,20] --> Loop 12

### Ranking functions of CR start(V,V1)

#### Partial ranking functions of CR start(V,V1)


Computing Bounds
=====================================

#### Cost of chains of from(V,Out):
* Chain [8]: 2
with precondition: [2*V+3=Out,V>=0]

* Chain [7]: 1
with precondition: [V+1=Out,V>=0]


#### Cost of chains of activate(V,Out):
* Chain [[10,11],9]: 5*it(10)+1
Such that:aux(3) =< V
it(10) =< aux(3)

with precondition: [V>=1,Out>=V]

* Chain [9]: 1
with precondition: [V=Out,V>=0]


#### Cost of chains of start(V,V1):
* Chain [12]: 5*s(2)+2
Such that:s(1) =< V
s(2) =< s(1)

with precondition: [V>=0]


Closed-form bounds of start(V,V1):
-------------------------------------
* Chain [12] with precondition: [V>=0]
- Upper bound: 5*V+2
- Complexity: n

### Maximum cost of start(V,V1): 5*V+2
Asymptotic class: n
* Total analysis performed in 80 ms.

(12) BOUNDS(1, n^1)